from typing import List


class Solution:
    def combine(self, n: int, k: int) -> List[List[int]]:
        result = []
        path = []
        self.backtracking(n, k, 1, path, result)
        return result

    def backtracking(self, n, k, start, path, result):
        if len(path) == k:
            result.append(path.copy())
            return
        for i in range(start, n + 1):
            path.append(i)
            self.backtracking(n, k, i + 1, path, result)
            path.pop()

print(Solution().combine(5, 2))
